package io;

import java.io.*;

/**
 * JAVA IO将流分为两类：节点流和处理流(过滤流)
 * 节点流也称为低级流，
 *
 * 处理流也称为高级流    ：使用高级流的 目的是为了提高效率
 * BufferedInputStream 和 BufferedOutputStream :提高读写效率
 */

public class CopyDemo3 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("./xu.mp3");
        //BufferedInputStream(InputStream in, int size)//size：缓冲区大小
        //BufferedInputStream(InputStream in)
        BufferedInputStream bis = new BufferedInputStream(fis);

        FileOutputStream fos = new FileOutputStream("./xu_cp.mp3");
        BufferedOutputStream bos = new BufferedOutputStream(fos);

        int d;
        long start = System.currentTimeMillis();
        while ((d = bis.read()) != -1){
            bos.write(d);
        }
        long end = System.currentTimeMillis();
        System.out.println("时间：" + (end-start) + "ms");
        bis.close();
        bos.close();
    }
}
